<?php use_helper('I18N', 'Date', 'JavascriptBase') ?>
<?php use_helper('CrossApp') ?>
<?php include_partial('ct_documento/assets') ?>
<?php $documento = CtDocumentoPeer::retrieveByPK($CtDocumento->getId()); ?>
<script type="text/javascript">
  var url_getComentarios = '<?php echo url_for("ct_documento/getComentarios") ?>';
  var url_saveVoto = '<?php echo url_for("ct_documento/saveVoto") ?>';
</script>
<div id="titulo">
  <p>FICHA BIBLIOGRAFICA <span id="sub_titulo">Visualizaci&oacute;n Detallada</span></p>
</div>

<ul id="tab" class="nav nav-tabs">
  <li class="active"><a data-toggle="tab" href="#detalle">Detalle</a></li>
  <?php if (isset($contenido)): ?>
    <li><a data-toggle="tab" href="#contenido">Contenido</a></li>
  <?php endif; ?>
  <li><a data-toggle="tab" href="#aacr2">AACR2</a></li>
</ul>

<div id="sf_admin_container">
  <div  id="myTabContent" class="tab-content left_column">

    <div class="tab-pane active" id="detalle">
      <table>
        <tbody>
          <?php foreach ($caracteristicas as $titulo => $caracteristica): ?>
            <tr>
              <td class="titulo_caracteristica">
                <h3>
                  <?php echo $titulo ?>
                </h3>
              </td>
              <td class="valor_caracteristica">
                <?php if (is_string($caracteristica) || is_integer($caracteristica)): ?>
                  <p><?php echo $caracteristica ?></p>
                <?php else: ?>
                  <p>
                    <?php foreach ($caracteristica as $sub_titulo => $valor): ?>
                      <?php echo sfOutputEscaper::unescape($valor); ?>
                      <span class="separador"> | </span>
                    <?php endforeach; ?>
                  </p>
                <?php endif; ?>
              </td>
            </tr>
          <?php endforeach; ?>
        </tbody>
      </table>
    </div>

    <div class="tab-pane tab_pane" id="aacr2">
      <div class="tab_content"> 
        <?php foreach ($caracteristicasAACR2 as $key => $caracteristica): ?>
          <?php if ($caracteristica != ''): ?>
            <?php #$str = str_replace(" ", "&nbsp;", $caracteristica); ?>
            <?php #echo str_replace("\n", "<br />", $str); ?>
            <p> <?php echo sfOutputEscaper::unescape($caracteristica); ?> </p>
            
          <?php endif; ?>
        <?php endforeach; ?>
      </div>
    </div>

    <?php if (isset($contenido)): ?>
      <div class="tab-pane tab_pane" id="contenido">
        <div class="accordion" id="accordion3">
          <?php $count = 1 ?>
          <?php foreach ($contenido as $titulo => $valor): ?>
            <div class="accordion-group">
              <div class="accordion-heading">
                <a class="accordion-toggle" data-toggle="collapse" href="#<?php echo 'contenido' . $count ?>">
                  <?php echo $titulo ?>
                </a>
              </div>
              <div id="<?php echo 'contenido' . $count ?>" class="accordion-body collapse in">
                <div class="accordion-inner">
                  <div class="cuerpo_detalle">
                    <p><?php $str = str_replace(" ", "&nbsp;", $valor);
              echo str_replace("\n", "<br />", $str); ?></p><br />
                  </div>
                </div>
              </div>
            </div>
            <?php $count++ ?>
          <?php endforeach; ?>
        </div>
      </div>
    <?php endif; ?>

  </div>

  <div class="right_column well">
    <div id="imagen" class="block">
      <img src="<?php echo $documento->getFullPathImage() ?>" width="<?php echo sfConfig::get('app_imagen_libro_thumbnail_width') ?>" height="<?php echo sfConfig::get('app_imagen_libro_thumbnail_height') ?>" border="0" alt="Portada" />
    </div>
    <div id="rating_loader" class="loader block">    </div>
    <div id="rating" class="block">  
      <?php include_partial('ct_documento/rating', array('CtDocumento' => $documento)) ?>
    </div>
    <div id="qrcode">
      <img alt="<?php echo $documento ?>" src="<?php echo $documento->getPathQrCode(true); ?>" />
    </div>
  </div>

  <div id="opac_social" class="left_column">
    <div id="share_box" class="well">
      <!-- AddThis Button BEGIN -->
      <div class="float_left">
        <span class="text_well bold">Compartir:</span>
      </div>
      <div class="addthis_toolbox addthis_default_style float_left" addthis:url="<?php echo link_to_frontend('documento', $documento); ?>">
        <a class="addthis_button_linkedin_counter addthis"></a>
        <a class="addthis_button_tweet addthis"></a>
        <a class="addthis_button_facebook_like addthis" fb:like:layout="button_count"></a>
      </div>
      <div class="clear">   </div>
      <!-- AddThis Button END -->
    </div>
    <div id="comments_loader" class="loader">    </div>
    <div id="comments_box" class="well">   </div>
  </div>
  <div class="clear"> </div>
</div>
